package com.cnpc.rightslogan.service.impl;

import com.cnpc.rightslogan.entity.User;
import com.cnpc.rightslogan.mapper.UserMapper;
import com.cnpc.rightslogan.service.IUserService;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
@Transactional
public class UserSimpleServiceImpl implements IUserService {

    @Resource
    private UserMapper userMapper;

    @Override
    public User getUser(int id) {
        User user = new User();
        user.setUserId(id);
        return userMapper.selectOne(user);
    }

    @Override
    public User getUser(User user) {
        return null;
    }

    @Override
    public PageInfo<User> getUserList(Integer pageNum, Integer pageSize, User user) {
        return null;
    }

    @Override
    public Integer addUser(User user) {
        return userMapper.insert(user);
    }

    @Override
    public Integer updateUser(User user) {
        return userMapper.updateByPrimaryKeySelective(user);
    }

    @Override
    public Integer deleteUser(User user) {
        return userMapper.delete(user);
    }
}
